import React from 'react'
import { createBehavior, createResource } from '@designable/core'
import { DnFC } from '@designable/react'
import { AllSchemas } from '../../schemas'
import { AllLocales } from '../../locales'
import { MultiLanguageDialog as CustomMultiLanguageDialog } from '../../customComponents/MultiLanguageDialog'
import { createFieldSchema } from '../Field'

export const MultiLanguageDialog: DnFC<
  React.ComponentProps<typeof CustomMultiLanguageDialog>
> = CustomMultiLanguageDialog

MultiLanguageDialog.Behavior = createBehavior({
  name: 'MultiLanguageDialog',
  extends: ['Field'],
  selector: (node) => node.props['x-component'] === 'MultiLanguageDialog',
  designerProps: {
    propsSchema: AllSchemas.MultiLanguageDialog,
  },
  designerLocales: AllLocales.MultiLanguageDialog,
})

MultiLanguageDialog.Resource = createResource({
  icon: 'TextSource',
  elements: [
    {
      componentName: 'Field',
      props: {
        type: 'void',
        title: 'MultiLanguageDialog',
        'x-component': 'MultiLanguageDialog',
        'x-component-props': {
          dialogName: '多语言对话框',
          formType: 'input',
          nameKey: 'content',
        },
      },
    },
  ],
})
